<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>国培项目管理系统</title>
  <link rel="stylesheet" href="/assets/libs/layui/css/layui.css" />
  <link rel="stylesheet" href="/css/admin.css" />
  <link rel="stylesheet" href="/assets/module/admin.css?v=318" />
  <link rel="stylesheet" href="/assets/css/theme-all.css?v=318" />
  <style>
    /* 确保下拉框显示完整 */
    .layui-nav .layui-nav-item .layui-nav-child{
      z-index: 999; /* 确保下拉框显示在最顶部 */
      position: absolute; /* 子菜单设置为绝对定位 */
      top: 100%; /* 下拉框位置调整到导航项正下方 */
      left: 0; /* 从左侧开始对齐 */
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); /* 添加阴影提升层次感 */
    }
    .layui-layout-right {
      position: absolute !important;
      right: 4px;
      top: 0;
    }
    /* 修复可能的超出隐藏问题 */
    .layui-header {
      position: relative;
      z-index: 999; /* 确保导航部分显示在最顶部 */
    }

    /* 调整下拉框内的项目样式 */
    .layui-nav-child dd a {
      padding: 10px 15px; /* 添加内边距 */
      display: block; /* 确保点击区域完整 */
      white-space: nowrap; /* 防止内容折行 */
    }
    .layui-icon.admin-tabs-control {
      display: none !important;
    }
  </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">

    <!-- 头部 -->
    <div class="layui-header">
      <div class="layui-logo" style="padding:0;display: flex;flex-wrap: nowrap">
        <div style="max-height: 20px;max-width: 22px;margin-left: 10px">
          <img src="/static/images/admin_logo.png" style="width: 100%;height: 100%">
        </div>
        <div style="display: flex;flex-direction: column;text-align: left;margin-left: 15px">
          <div style="font-size: 14px;line-height: 55px !important;">国培项目管理</div>
        </div>
      </div>

    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item layui-hide-xs" lay-unselect>
        <a ew-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a>
      </li>

      <li class="layui-nav-item" lay-unselect>
        <a>
          <img src="/static/images/timg.jpg" class="layui-nav-img">
          <cite>班主任</cite>
        </a>
        <dl class="layui-nav-child">
          <dd lay-unselect><a href="#" id="btnMyInfo">个人中心</a></dd>
          <dd lay-unselect><a href="#" id="btnChangePwd">修改密码</a></dd>
          <hr>
          <dd lay-unselect><a href="#" id="btnLogout">退出</a></dd>
        </dl>
      </li>
    </ul>
  </div>

  <!-- 侧边栏 -->
  <div class="layui-side">
    <div class="layui-side-scroll">
      <ul class="layui-nav layui-nav-tree" lay-filter="admin-side-nav" lay-shrink="_all" style="margin: 15px 0;">
        <li class="layui-nav-item">
          <a><i class="layui-icon layui-icon-app"></i>&emsp;<cite>过程管理</cite></a>
          <dl class="layui-nav-child">
            <dd><a lay-href="/class/index">班级管理</a></dd>
            <dd><a lay-href="/course/index">课程管理</a></dd>
            <dd><a lay-href="/homework/index">作业发布</a></dd>
            <dd><a lay-href="/log/index">日志管理</a></dd>
          </dl>
        </li>
      </ul>
    </div>
  </div>

  <!-- 主体部分 -->
  <div class="layui-body"></div>

</div>

<!-- 加载动画 -->
<div class="page-loading">
  <div class="ball-loader">
    <span></span><span></span><span></span><span></span>
  </div>
</div>

<!-- js部分 -->
<script type="text/javascript" th:src="@{/assets/libs/layui/layui.js}"></script>
<script type="text/javascript" th:src="@{/js/common.js}"></script>
<script>
  layui.use(['index', 'form'], function () {
    var $ = layui.jquery;
    var index = layui.index;
    var form = layui.form;

    // 默认加载主页
    index.loadHome({
      menuPath: '/home',
      menuName: '<i class="layui-icon layui-icon-home"></i>'
    });

    // 修改密码
    $('#btnChangePwd').click(function () {
      layer.open({
        type: 2,
        title: '修改密码',
        fixed: false,
        maxmin: false,
        scrollable: true,
        area: ['585px', '430px'],
        content: '/admin/changePwdform'
      });
    });

    // 个人信息
    $('#btnMyInfo').click(function () {
      layer.open({
        type: 2,
        title: '个人信息',
        fixed: false,
        maxmin: false,
        scrollable: true,
        area: ['750px', '480px'],
        content: '/admin/userInfoform'
      });
    });

    // 退出
    $('#btnLogout').click(function () {
      $.post("/user/logout", {}, function (res) {
        console.log(res);
        window.location.href = '/login'
      });
    });
  });
  // 监听导航点击事件
  layui.use(['element'], function () {
    var element = layui.element;

    // 监听选项卡删除事件
    element.on('tabDelete', function (data) {
      console.log(data.index); // 被删除的选项卡的索引
    });

    // 监听选项卡切换事件
    element.on('tabChange', function (data) {
      console.log(data.index); // 当前切换到的选项卡索引
    });
  });
</script>
</body>
</html>
